<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../../base.jsp"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<sys:genericTag4o id="templateTable" methodName="getTemplateTable" className="com.tmpt.controller.taglib.TemplateTag">
	<sys:columnTag columnName="keyRandom" columnValue="${paramValues._keyRandom[0]}"/>
</sys:genericTag4o>
<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="${path}/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/themes/fusioncharts.theme.fint.js"></script>

<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.charts.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.gantt.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.maps.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.powercharts.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.ssgrid.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.treemap.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.widgets.js"></script>
<script type="text/javascript" src="../../../js/fusioncharts-suite-xt/js/fusioncharts.zoomscatter.js"></script>

<script type="text/javascript">
var chartWidth = '${templateTable.chartWidth}'
var chartHeight = '${templateTable.chartHeight}'
if(chartWidth=='0'){
	chartWidth =500;
}
if(chartHeight=='0'){
	chartHeight =350;
}

var _chartType = '${paramValues._chartType[0]}';
if(_chartType == ''){
	_chartType = 'msspline';
}

$(function(){
	$.ajax({
		type:"POST",
		url:'${path}/admin123/template/charts/chartAjax_chartMultiJson.action?_keyRandom=${paramValues._keyRandom[0]}',
		dataType:"json",
		//data:{'keyRandom':'${paramValues._keyRandom[0]}'},
		success:function(msg){
			var fusioncharts = new FusionCharts({
				//msline,mscolumn2d,mscolumn3d,msarea,msspline,
				//scrollcolumn2d
			    type: _chartType,
			    renderAt: 'chart-container',
			    width: '100%',
			    height: '100%',
			    dataFormat: 'json',
			    dataSource: msg
			}
			);
    		fusioncharts.render();
		},
		error:function(er){
	         window.parent.error(er);
		}
	});
});


/*
FusionCharts.ready(function(){
    var fusioncharts = new FusionCharts({
	    type: 'msspline',
	    renderAt: 'chart-container',
	    width: '500',
	    height: '350',
	    dataFormat: 'json',
	    dataSource:{
    "chart": {
        
            "caption": "Monthly revenue for last year",
            "subCaption": "Harry's SuperMart",
            "xAxisName": "Month",
            "yAxisName": "Revenues (In USD)",
            "theme": "fint"
    },
    "categories": [
        {
            "category": [
                {
                    "label": "Mon"
                },
                {
                    "label": "Tue"
                },
                {
                    "label": "Wed"
                },
                /*
                {
                    "vline": "true",
                    "lineposition": "0",
                    "color": "#6baa01",
                    "labelHAlign": "right",
                    "labelPosition": "0",
                    "label": "National holiday"
                },
                {
                    "label": "Thu"
                },
                {
                    "label": "Fri"
                },
                {
                    "label": "Sat"
                },
                {
                    "label": "Sun"
                }
            ]
        }
    ],
    "dataset": [
        {
            "seriesname": "Bakersfield Central",
            "data": [
                {
                    "value": "15123"
                },
                {
                    "value": "14233"
                },
                {
                    "value": "25507"
                },
                {
                    "value": "9110"
                },
                {
                    "value": "15529"
                },
                {
                    "value": "20803"
                },
                {
                    "value": "19202"
                }
            ]
        },
        {
            "seriesname": "Los Angeles Topanga",
            "data": [
                {
                    "value": "13400"
                },
                {
                    "value": "12800"
                },
                {
                    "value": "22800"
                },
                {
                    "value": "12400"
                },
                {
                    "value": "15800"
                },
                {
                    "value": "19800"
                },
                {
                    "value": "21800"
                }
            ]
        }
    ]
} 
    })
    
    
    fusioncharts.render();
});
*/
</script>
</head>
<body>
  <div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>